
export JAVA_HOME=/home/admin/jdk-24.0.2
export PATH=$JAVA_HOME/bin:$PATH

JAR_PATH="/home/admin/0xcafe/app.jar"
LOG_DIR="./logs"

mkdir -p $LOG_DIR/{gc-log,heapdump}

initial_heap_size="256m"
max_heap_size="256m"

APP_RUN_PATH="--server.port=8088 --spring.data.redis.host=127.0.0.1 --spring.profiles.active=test"

JVM_OPTS="-XX:+UseZGC \
	  -XX:+HeapDumpOnOutOfMemoryError \
	  -XX:HeapDumpPath=$LOG_DIR/heapdump/heapdump.hprof \
          -XX:+TieredCompilation \
          -XX:+UseNUMA \
          -Xms${initial_heap_size} -Xmx${max_heap_size} \
          -XX:NewRatio=4 \
          -Xlog:gc*:file=$LOG_DIR/gc-log/gc.log:time,uptime,pid,tid:filecount=10,filesize=20M"

# sky的agent
JAVA_AGENT=-javaagent:/home/skywalking/skywalking-agent/skywalking-agent.jar # SkyWalking Agent jar 地址。


pkill -f ${JAR_PATH}

## nohup java $JVM_OPTS -jar ${JAR_PATH} $APP_RUN_PATH  > /dev/null 2>&1 &

## nohup java $JVM_OPTS -jar ${JAR_PATH} $APP_RUN_PATH  > ./logs/nohub.log 2>&1 & 

## nohup java $JVM_OPTS $JAVA_AGENT -Dskywalking.agent.service_name=zero-application -Dskywalking.collector.backend_service=127.0.0.1:11800 -jar ${JAR_PATH} $APP_RUN_PATH > /dev/null 2> ./logs/nohup-error.log &

nohup java -jar ${JAR_PATH} $APP_RUN_PATH > /dev/null 2> ./logs/nohup-error.log &


